/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package technotheist.data.grid;

import java.util.EnumMap;
import technotheist.data.BufferManager;

/**
 *
 * @author Mitch
 */
public class VolumeSet<FVar extends Enum<FVar>, T> {
    //	private System upper;
    //	private System lower;
    private final int layers;
    private final int width;
    private final int breadth;
    //
    //	private final Volume<BVecF> vertices; //width+1, height+1
    private final EnumMap<FVar, Volume<T>> volume; //

    public VolumeSet(FVar[] fvars, BufferManager mngr, int layers, int width, int breadth) {
	int vc = (layers + 1) * (width + 1) * (breadth + 1);
	this.layers = layers;
	this.width = width;
	this.breadth = breadth;
	//	    vertices = new Volume<>(mngr, BVecF.class, Size.n3, layers + 1, width + 1, breadth + 1);
	volume = new EnumMap<>(fvars[0].getClass());
	for (FVar fvar : fvars) {
	    Volume vol = new Volume(mngr, Float.TYPE, null, layers, width, breadth);
	    volume.put(fvar, vol);
	}
    }

    public Layer<T> getUpper(FVar var) {
	Volume<T> vol = volume.get(var);
	return vol.layers[vol.cnt - 1];
    }

    public Layer<T> getLower(FVar var) {
	Volume<T> vol = volume.get(var);
	return vol.layers[0];
    }

    public BorderPlane<T> getLeft(FVar var) {
	Volume<T> vol = volume.get(var);
	return vol.borders.get(BorderType.Left);
    }

    public BorderPlane<T> getRight(FVar var) {
	Volume<T> vol = volume.get(var);
	return vol.borders.get(BorderType.Right);
    }

    public BorderPlane<T> getFront(FVar var) {
	Volume<T> vol = volume.get(var);
	return vol.borders.get(BorderType.Front);
    }

    public BorderPlane<T> getBack(FVar var) {
	Volume<T> vol = volume.get(var);
	return vol.borders.get(BorderType.Back);
    }
    //	public Layer<BVecF> upperVerts() {
    //	    return vertices.layers[vertices.cnt - 1];
    //	}
    //
    //	public Layer<BVecF> lowerVerts() {
    //	    return vertices.layers[0];
    //	}
    
}
